package com.winsdom.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.math.BigDecimal;

@Data
public class ResourceDTO {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键id")
    private Integer id;
    /**
     * 父级分类ID
     */
    @ApiModelProperty(value = "父级分类ID")
    @NotBlank(message = "父分类ID不能为空")
    private Long parentId;

    @NotBlank(message = "资源名称不能为空")
    @Size(max = 20, message = "资源名称长度不能超过50个字符")
    @ApiModelProperty(value = "资源名称")
    private String resourceName;

    @NotNull(message = "资源类型不能为空")
    @Min(value = 0, message = "资源类型值不合法")
    @Max(value = 1, message = "资源类型值不合法")
    @ApiModelProperty(value = "资源类型")
    private Integer resourceType;

    @NotBlank(message = "资源编号不能为空")
    @Size(max = 50, message = "资源编号长度不能超过50个字符")
    @ApiModelProperty(value = "资源编号")
    private String resourceNumber;

    @NotBlank(message = "是否虚拟资源不能为空")
    @ApiModelProperty(value = "是否虚拟资源")
    private Integer virtualResources;

    @NotNull(message = "建筑面积不能为空")
    @DecimalMin(value = "0.01", message = "建筑面积不能小于0.01")
    @Digits(integer = 10, fraction = 2, message = "建筑面积格式不正确")
    @ApiModelProperty(value = "建筑面积")
    private BigDecimal buildingArea;

    @NotNull(message = "套内面积不能为空")
    @DecimalMin(value = "0.01", message = "套内面积不能小于0.01")
    @Digits(integer = 10, fraction = 2, message = "套内面积格式不正确")
    @ApiModelProperty(value = "套内面积")
    private BigDecimal interiorArea;

    @NotNull(message = "容量值不能为空")
    @Min(value = 1, message = "容量值不能小于1")
    @ApiModelProperty(value = "容量值")
    private Integer capacity;
}
